
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Simple YQL Query</title>

<style type="text/css">
/*margin and padding on body element
  can introduce errors in determining
  element position and are not recommended;
  we turn them off as a foundation for YUI
  CSS treatments. */
body {
	margin:0;
	padding:0;
}
</style>

<link type="text/css" rel="stylesheet" href="../../build/cssfonts/fonts-min.css" />
<script type="text/javascript" src="../../build/yui/yui-min.js"></script>

<!--there is no custom header content for this example-->

</head>

<body class="yui3-skin-sam  yui-skin-sam">

<h1>Simple YQL Query</h1>

<div class="exampleIntro">
	<p>In this example, we make a simple YQL Query to retrieve data from the Yahoo! Weather YQL table.</p>
			
</div>

<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->

<style>
#res .mod {
    background-color:white;
    border:1px solid black;
    padding:1em;
}
#res h2 {
    color: black;
}
</style>


<div id="res"></div>


<script>

YUI({ filter: 'raw' }).use('node', 'yql', function(Y) {
    
    var res = Y.one('#res'),
        zip = '90210';
    
    Y.YQL('select * from weather.forecast where location=' + zip, function(r) {
        var el = Y.Node.create('<div class="mod"></div>');

        el.set('innerHTML', '<h2>Weather for ' + zip + '</h2>' + r.query.results.channel.item.description);

        res.appendChild(el);
    
    });
});
</script>

<!--END SOURCE CODE FOR EXAMPLE =============================== -->

</body>
</html>
